define(["jQuery", "kendo" ], function ($, kendo ) {
    return {
		
		show : function(){
		if(App.isTeacher == 1)
			{
				var url = App.baseUrl+"CommHub/get_group/"; 
				
				var request =$.ajax({
						type: 'POST',
						url: url
					});
				request.done(function(msg) {  
					var parsedObject = JSON.parse(msg);	
					var allOpt="";
					for(var i=0;i<parsedObject.length;i++)
					{
						allOpt += '<option value="'+parsedObject[i].AWBGROUP_ID+'">'+parsedObject[i].AWBGROUP_NAME+' ('+parsedObject[i].WS_NAME+')</option>';
					}
					$('#saveas-group-selector').empty().append(allOpt);
					$( "#save-as-dragable-menu" ).show();
				});
				request.fail(function(jqXHR, textStatus) {
				});
				request.always(function(){
				});
			}
			else
			{
				$( "#save-as-dragable-menu" ).show();
			}
			// $(".ok-page-button").hide();
			$("#txt-file-name").val("");
		},
		
		
        init: function (e) {
			if(App.isTeacher==0)
			{
				$('#saveas-group-selector').hide();
				$('#saveas-group-tag').hide();
			}
			$("#save-as-dragable-menu").draggable();
			$("#save-as-dragable-menu").hide();
			
			$("#txt-file-name").val("");
			$('#txt-file-name').on( 'click', function (e) {  
				$(this).focus();
			});
			$('.save-as-file').click(function() {
				// if(App.isModeArea == 1){
					App.saveAsFile.show();
				// }else{
					// alert(App.localize("%view_mode_warning_dialog"));
				// }
			});
		
			$(".save-as-button").click(function() { 
				if($("#txt-file-name").val() == "")
				{
					alert(App.localize("%no_file_name_warning"));
				}
				else
				{
					if(App.isTeacher==0)
					{
						App.saveAsFileObject($("#txt-file-name").val(),$("#template-page").is(':checked'),-1);
					}
					else
					{
						App.saveAsFileObject($("#txt-file-name").val(),$("#template-page").is(':checked'),$("#saveas-group-selector").val());
					}
					$( "#save-as-dragable-menu" ).hide();	
					$("#txt-file-name").val("");
				}
			
			});
			
			$(".cancel-button-save-as").click(function() {
				var r=confirm(App.localize("%cancel_confirmation"));
				if (r==true)
				{  
					$( "#save-as-dragable-menu" ).hide();
					$(".file-name").val("");
				}
				else
				{
					console.log("You pressed Cancel!");
				}
			}); 
			
			
		
		}
	}
});